package com.hengtuo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.ImageView;
import android.widget.TextView;

import com.hengtuo.kaiyuanzhongguo.R;
import com.hengtuo.vo.Entity;

import java.util.List;

/**
 * Created by hairong on 2016/5/9.
 */
public class loginAdapter extends BaseAdapter {
    private List<Entity> entityList;
    private Context context;

    public loginAdapter(List<Entity> entityList, Context context) {
        this.entityList = entityList;
        this.context = context;
    }

    @Override
    public int getCount() {
        return entityList.size();
    }

    @Override
    public Object getItem(int position) {
        return null;
    }

    @Override
    public long getItemId(int position) {
        return 0;
    }

    @Override
    public View getView(int position, View convertView, ViewGroup parent) {
        ViewHolder vv;
        if(convertView==null){
            vv=new ViewHolder();
            convertView= LayoutInflater.from(context).inflate(R.layout.layoutlogin,null);
            vv.textView3= (TextView) convertView.findViewById(R.id.textView3);
            vv.imageView2= (ImageView) convertView.findViewById(R.id.imageView2);
            convertView.setTag(vv);
        }else{
            vv= (ViewHolder) convertView.getTag();
        }
        vv.textView3.setText(entityList.get(position).getName());
        vv.imageView2.setImageResource(entityList.get(position).getImage());
        return convertView;
    }

    public class ViewHolder {
        public  ImageView imageView2;
        public  TextView textView3;
    }
}
